Ext.namespace("org.microsite.server");

Server.prototype.getType = function() {return 'Server';};

org.microsite.util.ViewRegistry.add(new org.microsite.util.ViewHelper({
    type : Server,
    service : ServerRemote,
    editor : org.microsite.server.ServerEditor,
    template : new Ext.XTemplate('<table border="0" cellspacing="5">',
            '<tr><td><b>Type</b></td><td>{type}</td></tr>',
            '<tr><td><b>Name</b></td><td>{name} {version}</td></tr>',
            '<tr><td><b>Description</b></td><td>{description}</td></tr>',
            '<tr><td><b>Path(s)</b></td><td>{path}<br/>{dataPath}</td></tr>',
            '<tr><td><b>Service</b></td><td>{service}</td></tr>',
            '<tr><td><b>Hosted on</b></td><td>{host}</td></tr>',
            '<tr><td><b>Port</b></td><td>{port}</td></tr>',
            '<tr><td><b>Admin</b></td><td>{admin}</td></tr>',
            '</table>'),
    fields : [{name:'id'},{name:'type'},{name:'name'},{name:'version'},{name:'description'},{name:'path'},
                {name:'dataPath'},{name:'service'},{name:'host'},{name:'port'},{name:'admin'}],
    
    getChildTypes : function(data) {
        return {
	        'WWW' : [Deployment],
	        'J2EE' : [Deployment],
	        'DBMS' : [Database],
	        'SVN' : [FileSet],
	        'SMTP' : [],
	        'POP3' : [],
	        'IMAP' : [],
	        'FTP' : [],
	        'Samba' : [Share],
	        'NFS' : [Share],
            'SSH' : []
        }[data.type];
    },
    parentNodes: [{
        name : 'host',
        type : Host
    }]
}));
